package prickworlds.structure;

/**
 * Event that is sent when a key is pressed, released or whatever
 * 
 * @author Faruk Acibal, Richard Dziambor, Christian Holzreuter, Nicolas Winkler
 * 
 */
public final class KeyEvent implements Event {

	/**
	 * Type to define what the event was created for
	 * 
	 * @author Nicolas Winkler
	 * 
	 */
	public static enum Type {
		NO_EVENT, PRESSED, RELEASED
	}

	/**
	 * The key that was pressed, released or whatever
	 */
	public int key;

	/**
	 * definition of the event
	 */
	public Type type;

	/**
	 * default constructor
	 */
	public KeyEvent() {
		type = Type.NO_EVENT;
	}

	/**
	 * returns true if the event is valid which means, he has never been
	 * invalidated
	 */
	@Override
	public void invalidate() {
		type = Type.NO_EVENT;
	}

	@Override
	public boolean isValid() {
		return type != Type.NO_EVENT;
	}
}
